Skip to content

Conversation

SkyVence
Copy link
Collaborator

@SkyVence SkyVence commented Oct 8, 2025

New clientbound packets (added)

  • src/networking/packet/clientbound/FinishConfiguration.cpp
  • src/networking/packet/clientbound/changeDifficulty.cpp
  • src/networking/packet/clientbound/clientboundKnowPacks.cpp
  • src/networking/packet/clientbound/cookieRequest.cpp
  • src/networking/packet/clientbound/gameEvent.cpp
  • src/networking/packet/clientbound/levelChunkWithLight.cpp
  • src/networking/packet/clientbound/play.cpp
  • src/networking/packet/clientbound/playerAbilities.cpp
  • src/networking/packet/clientbound/setHeldItem.cpp
  • src/networking/packet/templateClientBoundPacket.cpp

New serverbound packets (added)

  • src/networking/packet/serverbound/FinishConfiguration.cpp
  • src/networking/packet/serverbound/handleClientInformation.cpp
  • src/networking/packet/serverbound/handleConfirmTeleportation.cpp
  • src/networking/packet/serverbound/loginAcknowledged.cpp
  • src/networking/packet/serverbound/serverboundKnowPacks.cpp

Packets moved/renamed

  • src/networking/packet/loginStart.cpp → src/networking/packet/clientbound/loginStart.cpp
  • src/networking/packet/ping.cpp → src/networking/packet/clientbound/ping.cpp
  • src/networking/packet/status.cpp → src/networking/packet/clientbound/status.cpp
  • src/networking/packet/handshake.cpp → src/networking/packet/serverbound/handshake.cpp

Existing packet implementations modified

  • src/networking/packet/chunkBatch.cpp (modified)
  • src/networking/packet/chunkDataSimple.cpp (modified)
  • src/networking/packet/setCenterChunck.cpp (modified)
  • src/networking/packet/spawnSequence.cpp (modified)

Removed legacy packet files (superseded by new structure)

  • src/networking/packet/cookieRequest.cpp
  • src/networking/packet/finishConfiguration.cpp
  • src/networking/packet/handleClientInformation.cpp
  • src/networking/packet/loginAcknowledged.cpp
  • src/networking/packet/packetRouter.cpp
  • src/networking/packet/play.cpp

@SkyVence SkyVence marked this pull request as ready for review October 15, 2025 13:41
@Copilot Copilot AI review requested due to automatic review settings October 15, 2025 13:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces significant architectural improvements for handling Minecraft protocol communication, including world data management, region file support, and chunk streaming capabilities. The changes restructure packet handling with a cleaner separation between clientbound and serverbound packets, implement NBT parsing for world data, and add a configuration system with world management features.

Key Changes:

  • Implemented world data loading system with NBT parsing and region file support for chunk streaming
  • Restructured packet system with separation of clientbound/serverbound packets and new packet router architecture
  • Added configuration management system with world settings and server properties

Reviewed Changes

Copilot reviewed 85 out of 117 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/world/query.cpp New world query system for loading chunks from region files with NBT decompression
src/world/manager.cpp World manager implementation with level.dat loading and gzip/zlib decompression
src/server.cpp Updated server initialization to load world data and integrate new config system
src/networking/networkPacketRouter.cpp New centralized packet routing system replacing old router
src/networking/packet/clientbound/*.cpp New clientbound packet implementations for game state management
src/networking/packet/serverbound/*.cpp New serverbound packet handlers for client communication
src/lib/nbtParser.cpp NBT binary parser for Minecraft's Named Binary Tag format
src/lib/config.cpp New configuration management system
include/world/world.hpp World management API with LevelDat and ChunkData structures
include/network/server.hpp Updated server interface with world and config integration
Makefile Build system updates for new directory structure and zlib dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

getTagValue("DifficultyLocked", dataStruct.DifficultyLocked);
getTagValue("GameType", dataStruct.GameType);
getTagValue("generatorName", dataStruct.generatorName);
getTagValue("generatorVersion", dataStruct.generatorVersiona);
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'generatorVersiona' to 'generatorVersion'.

Suggested change
getTagValue("generatorVersion", dataStruct.generatorVersiona);
getTagValue("generatorVersion", dataStruct.generatorVersion);

Copilot uses AI. Check for mistakes.

// Level (VarInt) - current experience level
buf.writeVarInt(0);
// Level (VarInt) - current experience level
buf.writeVarInt(5);
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic number 5 is used without explanation. Consider using a named constant like 'DEFAULT_EXPERIENCE_LEVEL' to clarify the intent.

Copilot uses AI. Check for mistakes.

buffer.writeVarInt(1);
buffer.writeString("minecraft");
buffer.writeString("core");
buffer.writeString("1.21.5");
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded version string '1.21.5' should be retrieved from the server configuration to ensure consistency with the configured game version.

Copilot uses AI. Check for mistakes.

// server.getNetworkManager().getOutgoingQueue()->push(levelChunkPacket);

} else if (packet->getId() == 0x2B) {
// Playere loaded
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'Playere' to 'Player'.

Suggested change
// Playere loaded
// Player loaded

Copilot uses AI. Check for mistakes.

#include <vector>

struct RegistryEntry {
std::string name;
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'protocol_id' field in RegistryEntry struct lacks documentation. Add a comment explaining its purpose and valid range in the Minecraft protocol.

Suggested change
std::string name;
std::string name;
// Unique integer identifier for this entry in the Minecraft protocol.
// Must be a non-negative integer, unique within its registry, as defined by the protocol specification.

Copilot uses AI. Check for mistakes.

@SkyVence SkyVence changed the title Feature: Streaming chunks, region cache Feature: Optional packet, play packet, configuration packet Oct 15, 2025
@SkyVence SkyVence merged commit c644a48 into main Oct 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants